<extend name="Index/index" />
<block name="mycss">
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/my.css">
</block>

<block name="main">
    <div class="row">
        <div class="container">
            <div class="col-md-7 col-md-offset-1">
                <div><a href="<{:U('Collections/index')}>">《去我的收藏夹</a></div>
                <div class="mt10"><h3 style="color:#222;"><b><{$dand[0]['sname']}></b></h3></div>
                <div class="mt10"><{$dand[0]['fondcontent']}></div>
                    <div class="mt10" style="float:left"><a href="" data-toggle="modal" data-target="#myModal">编辑</a>
                    <span class="mt10"><a href="" class="del" bj="<{$_GET['id']}>">删除</a></span>
                        <!-- 模态框（Modal） -->
                         <for start="0" end="count($sto)">
                            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
                               aria-labelledby="myModalLabel" aria-hidden="true">

                               <div class="modal-dialog ">
                                  <div class="modal-content">
                                     <div class="modal-header bgq">
                                        <button type="button" class="close" 
                                           data-dismiss="modal" aria-hidden="true">
                                              &times;
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel">
                                           编辑收藏夹
                                        </h4>
                                     </div>
                                     <div class="modal-body">
                                        <form action="">

                                            <table>
                                            <tr style="margin-top:-25px;display: inline-block;">
                                            <th>标题:&nbsp;&nbsp;</th>
                                            <td><input type="text" maxlength="20" class="tit" value="<{$dand[$i]['sname']}>"></td>
                                            </tr>
                                            <tr style="margin-top:10px;display: inline-block;">
                                            <th>描述:&nbsp;&nbsp;</th>
                                            <td> <textarea name="" id="" cols="60" rows="4" maxlength="256" class="con"><{$dand[$i]['fondcontent']}></textarea> 
                                            </td>
                                            </tr>
                                            </table>
                                        </form>
                                     </div>
                                    <div class="modal-footer biaog" bhh="<{$Think.get.id}>">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <button type="button" class="btn btn-info fool bcun">
                                            保存
                                        </button>
                                    </div>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal -->
                    </for>
                </div>
            <div class="clearfix"></div>

            <hr>
            <volist  name="two" id="vo">
                <div class="mt10 shouqi" bh="<{$two[$i]['aid']}>">
                 <div>
                <div><h4 style="color:#259;"><b><a href="<{:U('Question/detail',array('qid'=>$vo['qid']))}>"><{$vo.qname}></a></b></h4></div>
                <div><a href="<{:U('Question/detail',array('qid'=>$vo['qid'],'aid'=>$vo['aid']))}>"><{$vo.apart}></a></div>
                <div class="mt10"><a href="" class="qushou" bh="<{$vo.aid}>"><h6 style="color:#999;">取消收藏</h6></a></div>
                <hr>
                </div>
                </div>
            </volist>
        </div>
    </div><!-- container -->
</div>

</block>

<block name="myjs">
<script>
    $(function(){
        $('.qushou').mouseover(function(){
            $(this).css('cursor','pointer');
        })

        var kkk = $('a.qushou');
        for (var i = 0; i < kkk.length; i++) {
            $(kkk[i]).click(function(){
                $(this).parent().parent().hide();
                var id=$(this).attr('bh');
                console.log(id);
                $.ajax({
                    post:'get',
                    url:"<{:U('Collections/qushou')}>",
                    data:'id='+id,
                    success:function(data){
                        // console.log(data);
                    }
                });
                return false;
            })
        };

        $('.bcun').click(function(){
            var id=$(this).parent().attr('bhh');
            $.ajax({
                type:'get',
                url:"<{:U('Collections/edit')}>"+'?id='+id,
                data:{'sname' : $('.tit').val(),'fondcontent' : $('.con').val(),'id':id},
                success:function(data){
                    // console.log(data);
                     window.location.reload();
                }
            })
        })

            $('.fool').click(function(){
            $(this).attr('aria-hidden','true');
            $(this).attr('data-dismiss','modal');
            $(this).attr('class','close');
        })
            $('.del').click(function(){
                var id=$(this).attr('bj');
                $.ajax({
                    type:'get',
                    url:"<{:U('Collections/del')}>"+'?id='+id,
                    success:function(){
                        alert('删除成功');
                        window.history.back();
                         // location.reload();
                         // history.go(-1);location.reload();
                    }
                })
            })
    })

</script>


</block>

